package com.moodbox.server.mood.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.moodbox.server.common.enums.MoodLevelEnum;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 心情记录实体
 */
@Data
@Accessors(chain = true)
@TableName("t_mood_record")
public class MoodRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 记录ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    /**
     * 用户ID
     */
    @TableField("user_id")
    private String userId;

    /**
     * 心情等级
     */
    @TableField("mood_level")
    private Integer moodLevel;

    /**
     * 心情描述
     */
    @TableField("mood_description")
    private String moodDescription;

    /**
     * 心情标签
     */
    @TableField("mood_tags")
    private String moodTags;

    /**
     * 心情图片URL列表（逗号分隔）
     */
    @TableField("mood_images")
    private String moodImages;

    /**
     * 位置信息
     */
    @TableField("location")
    private String location;

    /**
     * 天气信息
     */
    @TableField("weather")
    private String weather;

    /**
     * 活动信息
     */
    @TableField("activity")
    private String activity;

    /**
     * 记录日期
     */
    @TableField("record_date")
    private LocalDateTime recordDate;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    /**
     * 逻辑删除
     */
    @TableLogic
    @TableField("deleted")
    private Integer deleted = 0;

    /**
     * 获取心情等级枚举
     * @return 心情等级枚举
     */
    public MoodLevelEnum getMoodLevelEnum() {
        return MoodLevelEnum.getByCode(this.moodLevel);
    }

    /**
     * 设置心情等级枚举
     * @param moodLevelEnum 心情等级枚举
     * @return 当前心情记录对象
     */
    public MoodRecord setMoodLevelEnum(MoodLevelEnum moodLevelEnum) {
        this.moodLevel = moodLevelEnum.getCode();
        return this;
    }
} 